<template>
	<view class="box" >
		<view class="content-box">
			<view class="content" >
				<view class="no-data"  v-if="Data.user?Data.user.length:0" >
					<text>暂无数据</text>
				</view>
				<view class="" v-else >
					<view class="information">
						<text>住院信息</text>
						<text>{{Data.user.park}}</text>
					</view>
					<view class="information">
						<text>住院科室</text>
						<text>{{Data.user.inpatientDep}}</text>
					</view>
					<view class="information">
						<text>入院时间</text>
						<text>{{Data.user.inHospitalTime}}</text>
					</view>
					<view class="information">
						<text>出院时间</text>
						<text>{{Data.user.leaveHospitalTime}}</text>
					</view>
					<view class="information">
						<text>住院状态</text>
						<text>{{Data.user.status==0?'住院中':'已出院'}}</text>
					</view>
				</view>
				
			</view>
		</view>
		<view class="content-box">
			<view class="content">
				<view class="no-data"  v-if="Data.user?Data.user.length:0" >
					<text>暂无数据</text>
				</view>
				<view class="" v-else>
					<view class="information">
						<view><text>就诊人</text></view>
						<text>{{Data.user.name}}</text>
					</view>
					<view class="information">
						<text>证件类型</text>
						<text>{{Data.certificatesType}}</text>
					</view>
					<view class="information">
						<text>证件号码</text>
						<text>{{Data.user.cardNum}}</text>
					</view>
					<view class="information">
						<text>手机号</text>
						<text>{{Data.user.phone}}</text>
					</view>
					<view class="information">
						<text>就诊卡号</text>
						<text>{{Data.user.visitNum}}</text>
					</view>
					<view class="information">
						<text>住院号</text>
						<text>{{Data.user.inpatientNum}}</text>
					</view>
				</view>
				
			</view>
		</view>
		<view class="btn" >
			<view @click="checkInpatientRecharge"><text>住院充值</text></view>
		</view>
		<view class="footer"></view>
	</view>
</template>

<script setup>
	import {VisitInformationApi} from '@/api/ViewServices'
	import {onLoad} from "@dcloudio/uni-app"
import { reactive,onMounted } from "vue";
import {reportFormStore} from '@/store/reportFormStore.js'
	import {useLoginStore} from '@/store/loginStore'


const store=useLoginStore()
	let Data=reactive({
		id:'',
		user:'',
		certificatesType:'',
	})
onMounted(()=>{
	VisitInformationApi({patientId:Data.id,useId:store.id}).then((res)=>{
		Data.user=res.data.data;
		console.log('data',Data.user)
		if(Data.user!=null){
		switch(Data.user.idcardType){
			case 0:
			Data.certificatesType='身份证'
			break;
			case 1:
			Data.certificatesType='护照'
			break;
			case 2:
			Data.certificatesType='港澳台通行证'
			break;
		}	
		}
		})
})
onLoad((option)=>{
	Data.id=option.id
})
let checkInpatientRecharge = () => {
	uni.navigateTo({
		url: `/pages/hospitalRecharge/hospitalRecharge/hospitalRecharge?id=${Data.id}`
	})
}
</script>

<style scoped lang="less">
.box {
	width: 750rpx;
	background-color: #fbfdff;
}

.content-box {
	width: 750rpx;
	display: flex;
	justify-content: center;
	align-items: flex-end;

	.content {
		width: 688rpx;
		margin: 30rpx 0;
		background: white;
		box-shadow: 0 0 2px #e0e0e0;
		display: flex;
		flex-direction: column;
		align-items: center;

		.information {
			width: 610rpx;
			height: 110rpx;
			display: flex;
			align-items: center;
			border-bottom: 1px solid #f4f4f4;
		}

		.information text:nth-child(1) {
			width: 120rpx;
			display: flex;
			justify-content: space-between;
			font-size: 28rpx;
			color: #bbbcbd;
		}

		.information text:nth-child(2) {
			font-size: 28rpx;
			margin-left: 20rpx;
		}
	}
}
.btn {
	width: 750rpx;
	height: 146rpx;
	display: flex;
	justify-content: center;
	align-items: center;
	view {
		width: 688rpx;
		height: 82rpx;
		background-color: #006eff;
		color: white;
		font-size: 38rpx;
		border-radius: 10rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
}
.footer {
	width: 750rpx;
	height: 200rpx;
}
.no-data{
	display: flex;
	justify-content: center;
	margin: 200rpx 100rpx;
	font-size: 40rpx;
}
</style>
